<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Abstract class for models
 */
require_once 'ModelAbstract.php';

/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 */
class Application_Model_PilotListcolumn extends Application_Model_ModelAbstract
{

    /**
     * Database var type varchar(255)
     *
     * @var string
     */
    protected $_IdPILOTLISTCOLUMN;

    /**
     * Database var type varchar(512)
     *
     * @var string
     */
    protected $_LABELCOLUMN;

    /**
     * Database var type text
     *
     * @var text
     */
    protected $_DESCRIPTION;

    /**
     * Database var type varchar(45)
     *
     * @var string
     */
    protected $_TABELCOLUM;

    /**
     * Database var type varchar(512)
     *
     * @var string
     */
    protected $_COLUMNNAME;

    /**
     * Database var type varchar(255)
     *
     * @var string
     */
    protected $_OPERATIONSQL;

    /**
     * Database var type varchar(255)
     *
     * @var string
     */
    protected $_PILOTPLATEFORMEIdPILOTPLATEFORME;


    /**
     * Parent relation fk_PILOT_LISTCOLUMN_PILOT_PLATEFORME1
     *
     * @var Application_Model_PilotPlateforme
     */
    protected $_PilotPlateforme;


    /**
     * Dependent relation fk_PILOT_DEFCOLUMN_PILOT_LISTCOLUMN10
     * Type: One-to-Many relationship
     *
     * @var Application_Model_PilotDefcolumn
     */
    protected $_PilotDefcolumn;

    /**
     * Dependent relation fk_PILOT_NAMECOLUMN_PILOT_LISTCOLUMN1
     * Type: One-to-Many relationship
     *
     * @var Application_Model_PilotNamecolumn
     */
    protected $_PilotNamecolumn;

    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'idPILOT_LISTCOLUMN'=>'IdPILOTLISTCOLUMN',
            'LABELCOLUMN'=>'LABELCOLUMN',
            'DESCRIPTION'=>'DESCRIPTION',
            'TABELCOLUM'=>'TABELCOLUM',
            'COLUMNNAME'=>'COLUMNNAME',
            'OPERATIONSQL'=>'OPERATIONSQL',
            'PILOT_PLATEFORME_idPILOT_PLATEFORME'=>'PILOTPLATEFORMEIdPILOTPLATEFORME',
        ));

        $this->setParentList(array(
            'FkPILOTLISTCOLUMNPILOTPLATEFORME1'=> array(
                    'property' => 'PilotPlateforme',
                    'table_name' => 'PilotPlateforme',
                ),
        ));

        $this->setDependentList(array(
            'FkPILOTDEFCOLUMNPILOTLISTCOLUMN10' => array(
                    'property' => 'PilotDefcolumn',
                    'table_name' => 'PilotDefcolumn',
                ),
            'FkPILOTNAMECOLUMNPILOTLISTCOLUMN1' => array(
                    'property' => 'PilotNamecolumn',
                    'table_name' => 'PilotNamecolumn',
                ),
        ));
    }

    /**
     * Sets column idPILOT_LISTCOLUMN
     *
     * @param string $data
     * @return Application_Model_PilotListcolumn
     */
    public function setIdPILOTLISTCOLUMN($data)
    {
        $this->_IdPILOTLISTCOLUMN = $data;
        return $this;
    }

    /**
     * Gets column idPILOT_LISTCOLUMN
     *
     * @return string
     */
    public function getIdPILOTLISTCOLUMN()
    {
        return $this->_IdPILOTLISTCOLUMN;
    }

    /**
     * Sets column LABELCOLUMN
     *
     * @param string $data
     * @return Application_Model_PilotListcolumn
     */
    public function setLABELCOLUMN($data)
    {
        $this->_LABELCOLUMN = $data;
        return $this;
    }

    /**
     * Gets column LABELCOLUMN
     *
     * @return string
     */
    public function getLABELCOLUMN()
    {
        return $this->_LABELCOLUMN;
    }

    /**
     * Sets column DESCRIPTION
     *
     * @param text $data
     * @return Application_Model_PilotListcolumn
     */
    public function setDESCRIPTION($data)
    {
        $this->_DESCRIPTION = $data;
        return $this;
    }

    /**
     * Gets column DESCRIPTION
     *
     * @return text
     */
    public function getDESCRIPTION()
    {
        return $this->_DESCRIPTION;
    }

    /**
     * Sets column TABELCOLUM
     *
     * @param string $data
     * @return Application_Model_PilotListcolumn
     */
    public function setTABELCOLUM($data)
    {
        $this->_TABELCOLUM = $data;
        return $this;
    }

    /**
     * Gets column TABELCOLUM
     *
     * @return string
     */
    public function getTABELCOLUM()
    {
        return $this->_TABELCOLUM;
    }

    /**
     * Sets column COLUMNNAME
     *
     * @param string $data
     * @return Application_Model_PilotListcolumn
     */
    public function setCOLUMNNAME($data)
    {
        $this->_COLUMNNAME = $data;
        return $this;
    }

    /**
     * Gets column COLUMNNAME
     *
     * @return string
     */
    public function getCOLUMNNAME()
    {
        return $this->_COLUMNNAME;
    }

    /**
     * Sets column OPERATIONSQL
     *
     * @param string $data
     * @return Application_Model_PilotListcolumn
     */
    public function setOPERATIONSQL($data)
    {
        $this->_OPERATIONSQL = $data;
        return $this;
    }

    /**
     * Gets column OPERATIONSQL
     *
     * @return string
     */
    public function getOPERATIONSQL()
    {
        return $this->_OPERATIONSQL;
    }

    /**
     * Sets column PILOT_PLATEFORME_idPILOT_PLATEFORME
     *
     * @param string $data
     * @return Application_Model_PilotListcolumn
     */
    public function setPILOTPLATEFORMEIdPILOTPLATEFORME($data)
    {
        $this->_PILOTPLATEFORMEIdPILOTPLATEFORME = $data;
        return $this;
    }

    /**
     * Gets column PILOT_PLATEFORME_idPILOT_PLATEFORME
     *
     * @return string
     */
    public function getPILOTPLATEFORMEIdPILOTPLATEFORME()
    {
        return $this->_PILOTPLATEFORMEIdPILOTPLATEFORME;
    }

    /**
     * Sets parent relation PILOTPLATEFORMEIdPILOTPLATEFORME
     *
     * @param Application_Model_PilotPlateforme $data
     * @return Application_Model_PilotListcolumn
     */
    public function setPilotPlateforme(Application_Model_PilotPlateforme $data)
    {
        $this->_PilotPlateforme = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idPILOT_PLATEFORME'];
        }

        $this->setPILOTPLATEFORMEIdPILOTPLATEFORME($primary_key);

        return $this;
    }

    /**
     * Gets parent PILOTPLATEFORMEIdPILOTPLATEFORME
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_PilotPlateforme
     */
    public function getPilotPlateforme($load = true)
    {
        if ($this->_PilotPlateforme === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTLISTCOLUMNPILOTPLATEFORME1', $this);
        }

        return $this->_PilotPlateforme;
    }

    /**
     * Sets dependent relations fk_PILOT_DEFCOLUMN_PILOT_LISTCOLUMN10
     *
     * @param array $data An array of Application_Model_PilotDefcolumn
     * @return Application_Model_PilotListcolumn
     */
    public function setPilotDefcolumn(array $data)
    {
        $this->_PilotDefcolumn = array();

        foreach ($data as $object) {
            $this->addPilotDefcolumn($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_PILOT_DEFCOLUMN_PILOT_LISTCOLUMN10
     *
     * @param Application_Model_PilotDefcolumn $data
     * @return Application_Model_PilotListcolumn
     */
    public function addPilotDefcolumn(Application_Model_PilotDefcolumn $data)
    {
        $this->_PilotDefcolumn[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_PILOT_DEFCOLUMN_PILOT_LISTCOLUMN10
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_PilotDefcolumn
     */
    public function getPilotDefcolumn($load = true)
    {
        if ($this->_PilotDefcolumn === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTDEFCOLUMNPILOTLISTCOLUMN10', $this);
        }

        return $this->_PilotDefcolumn;
    }

    /**
     * Sets dependent relations fk_PILOT_NAMECOLUMN_PILOT_LISTCOLUMN1
     *
     * @param array $data An array of Application_Model_PilotNamecolumn
     * @return Application_Model_PilotListcolumn
     */
    public function setPilotNamecolumn(array $data)
    {
        $this->_PilotNamecolumn = array();

        foreach ($data as $object) {
            $this->addPilotNamecolumn($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_PILOT_NAMECOLUMN_PILOT_LISTCOLUMN1
     *
     * @param Application_Model_PilotNamecolumn $data
     * @return Application_Model_PilotListcolumn
     */
    public function addPilotNamecolumn(Application_Model_PilotNamecolumn $data)
    {
        $this->_PilotNamecolumn[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_PILOT_NAMECOLUMN_PILOT_LISTCOLUMN1
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_PilotNamecolumn
     */
    public function getPilotNamecolumn($load = true)
    {
        if ($this->_PilotNamecolumn === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTNAMECOLUMNPILOTLISTCOLUMN1', $this);
        }

        return $this->_PilotNamecolumn;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_PilotListcolumn
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_PilotListcolumn());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_PilotListcolumn::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getIdPILOTLISTCOLUMN() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('idPILOT_LISTCOLUMN = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getIdPILOTLISTCOLUMN()));
    }
}
